package com.five.welcome.controller;


import com.five.welcome.entity.Goods;
import com.five.welcome.result.Result;
import com.five.welcome.service.GoodsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author ywt
 * @since 2024-07-12
 */
@CrossOrigin
@Tag(name = "物资相关接口")
@RestController
@RequestMapping("/goods")
public class GoodsController {
    @Autowired
    private GoodsService goodsService;

    //查询所有物资
    @Operation(summary = "获取所有物资")
    @GetMapping("/getAllGoods")
    public Result getAllGoods() {
        List<Goods> goods = goodsService.getAllGoods();
        return Result.ok(goods);
    }

}

